<?php

namespace App\Command\Tests;

use Hyperf\Command\Command as HyperfCommand;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Input\InputArgument;

class BaseTests extends HyperfCommand
{
    /**
     * @var ContainerInterface
     */
    protected $container;


    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;

        parent::__construct();
    }

    protected function configure()
    {
        parent::configure();
        $this->addArgument('action', InputArgument::REQUIRED);
    }

    public function handle()
    {
        $action = $this->input->getArgument('action');
        if (!method_exists($this, $action)) {
            dump("方法 {$action} 未定义");
        }
        $this->$action();
    }
}